package effective_java.design_pattern.visitor;

import java.util.ArrayList;
import java.util.List;

/**
 * 结构对象角色
 *
 * @author Verlet
 * @date 2023-10-05 01:59
 */
public class Home {
    private List<Animal> animalList = new ArrayList<>();

    public void action(Person person){
        animalList.forEach(animal -> animal.accept(person));
    }

    public void add(Animal animal){
        animalList.add(animal);
    }
}
